function DrawParticle(a) {
	console.log("a",a);
	// 默认值
	a.width = a.width || window.innerWidth;//canvas的宽度
	a.height = a.height  || window.innerHeight;//canvas的高度
	a.time = a.time || 30;//间隔时间
	a.num = a.num || 25 //粒子的数量
	a.fillStyle = a.fillStyle || "rgba(0,0,0,1)";
	a.strokeStyle = a.strokeStyle || "rgba(0, 0, 0, 1)"
	a.particleType = a.particleType || circular //默认是绘制圆
	//canvas init
	var canvas = document.getElementById(a.id);
	var ctx = canvas.getContext("2d");
	//canvas dimensions
	var W = a.width ;
	var H = a.height;
	canvas.width = W;
	canvas.height = H;
	
	//snowflake particles
	var mp = a.num; //max particles
	var particles = [];
	for(var i = 0; i < mp; i++)
	{
		particles.push({
			x: Math.random()*W, //x-coordinate
			y: Math.random()*H, //y-coordinate
			r: Math.random()*a.r+1, //radius
			d: Math.random()*mp //density
		})
	}
	
	// 圆
	function circular()
	{
		ctx.clearRect(0, 0, W, H);
		ctx.fillStyle = a.fillStyle;
		ctx.beginPath();
		for(var i = 0; i < mp; i++)
		{
			var p = particles[i];
			ctx.moveTo(p.x, p.y);
			ctx.arc(p.x, p.y, p.r, 0, Math.PI*2, true);
		}
		ctx.fill();
		update();
	}
	/* 元宝 */
	function Yuanbao()
	{
		ctx.clearRect(0, 0, W, H);
		for(var i = 0; i < mp; i++)
		{
			var p = particles[i];
			drawYuanbao(p.r,p.x,p.y)
		}
		update();
	}
	// r决定大小,x,y决定位置
	function drawYuanbao(r,x,y)
	{
		ctx.fillStyle =  a.fillStyle;
		ctx.strokeStyle =  a.strokeStyle;
		ctx.beginPath();
		// 元宝突出的部分左边三阶曲线
		ctx.moveTo(r+x,r*4+y);
		ctx.bezierCurveTo(1.6*r+x,0+y,2.6*r+x,1.2*r*4+y,6*r+x,0.68*r*4+y);
		// 元宝突出的部分中间二阶曲线
		ctx.quadraticCurveTo(8.3*r+x,0.32*r*4+y,10*r+x,0.68*r*4+y);
		// 元宝突出的部分右边三阶曲线
		ctx.bezierCurveTo(12.6*r+x,1.25*r*4+y,14*r+x,0+y,15*r+x,r*4+y);
		// 元宝下面的弧度三阶曲线
		ctx.bezierCurveTo(16*r+x,2.8*r*4+y,0+x,2.8*r*4+y,r+x,r*4+y);
		ctx.fill();
		ctx.stroke();
		ctx.strokeStyle = a.strokeStyle;
		ctx.beginPath();
		// 元宝上面的弧度二阶曲线
		ctx.moveTo(1.6*r+x,0.6*r*4+y);
		ctx.quadraticCurveTo(7.5*r+x,2*r*4+y,14*r+x,0.6*r*4+y);
		ctx.stroke();
	}
	//Function to move the snowflakes
	//angle will be an ongoing incremental flag. Sin and Cos functions will be applied to it to create vertical and horizontal movements of the flakes
	var angle = 0;
	function update()
	{
		angle += 0.01;
		for(var i = 0; i < mp; i++)
		{
			var p = particles[i];
			//Updating X and Y coordinates
			//We will add 1 to the cos function to prevent negative values which will lead flakes to move upwards
			//Every particle has its own density which can be used to make the downward movement different for each flake
			//Lets make it more random by adding in the radius
			p.y += Math.cos(angle+p.d) + 1 + p.r/2;
			p.x += Math.sin(angle) * 2;
			
			//Sending flakes back from the top when it exits
			//Lets make it a bit more organic and let flakes enter from the left and right also.
			if(p.x > W+5 || p.x < -5 || p.y > H)
			{
				if(i%3 > 0) //66.67% of the flakes
				{
					particles[i] = {x: Math.random()*W, y: -10, r: p.r, d: p.d};
				}
				else
				{
					//If the flake is exitting from the right
					if(Math.sin(angle) > 0)
					{
						//Enter from the left
						particles[i] = {x: -5, y: Math.random()*H, r: p.r, d: p.d};
					}
					else
					{
						//Enter from the right
						particles[i] = {x: W+5, y: Math.random()*H, r: p.r, d: p.d};
					}
				}
			}
		}
	}
	switch(a.particleType){
		case "circular":
			setInterval(circular, a.time);
			break;
		case "Yuanbao":
			setInterval(Yuanbao, a.time);
			break;
	}
}